using System;
using UnityEngine;

namespace BCW.GameTypes.SkyBlock
{
	public class SkyFlagDropZone : MonoBehaviour
	{
		public PunTeams.Team team;

		public static event Action<PunTeams.Team> OnDropZoneCollision;

		private void Start()
		{
			SkyBlockController.instance.dropZones.Add(this);
		}

		private void OnTriggerEnter(Collider other)
		{
			PlayerBehavior componentInParent = other.GetComponentInParent<PlayerBehavior>();
			if (componentInParent != null && componentInParent.isMine && SkyFlagDropZone.OnDropZoneCollision != null)
			{
				SkyFlagDropZone.OnDropZoneCollision(team);
			}
		}
	}
}
